#include <stdio.h>
#include <stdlib.h>

typedef struct Node{
  int v;
  struct Node *next;
}Node;

Node* createnode(int v){
  Node* node = malloc(sizeof(Node));
  node->v = v;
  node->next = NULL;
  return node;
}

int gcd(int a,int b){
  return (b==0 ? a : gcd(b,a%b));
}

int main(int argc, char *argv[])
{
  int n;
  scanf("%d",&n);
  int* nums = malloc(n*sizeof(int));
  for(int i=0;i<n;i++){
    scanf("%d",&nums[i]);
  }
  
  // 建map
  Node** map = malloc(n*sizeof(Node*));
  for(int i=0;i<n;i++){
    map[i] = NULL;
  }
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(nums[i]%nums[j]==0){
        if(!map[i]){
          map[i] = createnode(j);
        }else{
          Node* node = map[i];
          while(node->next){
            node = node->next;
          }
          node->next = createnode(j);
        }
      }
      if(nums[j]%nums[i]==0){
        if(!map[j]){
          map[j] = createnode(i);
        }else{
          Node* node = map[j];
          while(node->next){
            node = node->next;
          }
          node->next = createnode(i);
        }
      }
    }
  }

  // 统计数量
  long long count = 0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int ci=0,cj=0,cg=0;
      Node* node1 = map[i];
      Node* node2 = map[j];
      // 计算最大公因数
      int g = gcd(nums[i],nums[j]);
      // 统计因数
      while(node1){
        if(node1->v==j){
          node1 = node1->next;
          continue;
        }
        if(g>0 && g%nums[node1->v]==0){
          cg++;
        }
        ci++;
        node1 = node1->next;
      }
      while(node2){
        if(node2->v==i){
          node2 = node2->next;
          continue;
        }
        cj++;
        node2 = node2->next;
      }
      printf("ci:%d, cj:%d, cg:%d\n",ci,cj,cg);
      count+=((long long)ci*cj-cg);
    }
  }

  printf("%lld",count*2);

  return 0;
}